package Controllers;

import Dao.TypeMapper;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TypeController {

    @Autowired
    private TypeMapper typeMapper;

    @RequestMapping(value = "/api/GetAllType", produces = "text/plain;charset=utf-8")
    public String getAllType(){

        String[] str=typeMapper.selectAllType();
        Gson gson = new GsonBuilder().create();
        String json = gson.toJson(str);
        System.out.println("AllType:" + json.toString());
        return json;
    }
}
